package com.acsior.hibernate.vo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernateVO;

/**
 * CdReceiptBody entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "cdReceiptBody")
@GeneratorKey(tableName = "cdReceiptBody")
public class CdReceiptBodyVO extends HibernateVO {
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -2003394981322629714L;

	@Column(name = "amount", nullable = false, precision = 18)
	private double amount;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "crCodeID", nullable = false)
	private CdCRCodeVO cdCRCode;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "receiptHeaderID", nullable = false)
	private CdReceiptHeaderVO cdReceiptHeader;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "typePaymentID", nullable = false)
	private CdTypePaymentVO cdTypePayment;

	@Column(name = "discount", nullable = false, precision = 18)
	private double discount;

	@Column(name = "quantity", nullable = false, precision = 18)
	private double quantity;

	@Id
	@Column(name = "receiptBodyID", unique = true, nullable = false)
	@GeneratedValue(strategy=GenerationType.AUTO)
	private long receiptBodyId;

	@Column(name = "tax", nullable = false, precision = 18)
	private double tax;

	@Column(name = "text", nullable = false)
	private String text;

	// Constructors

	/** default constructor */
	public CdReceiptBodyVO() {
		// и те така
	}

	
	/**
	 * @return стойността на amount
	 */
	public double getAmount() {
		return this.amount;
	}

	
	/**
	 * @param amount се залага в amount
	 */
	public void setAmount(double amount) {
		this.amount = amount;
	}

	
	/**
	 * @return стойността на cdCRCode
	 */
	public CdCRCodeVO getCdCRCode() {
		return this.cdCRCode;
	}

	
	/**
	 * @param cdCRCode се залага в cdCRCode
	 */
	public void setCdCRCode(CdCRCodeVO cdCRCode) {
		this.cdCRCode = cdCRCode;
	}

	
	/**
	 * @return стойността на cdReceiptHeader
	 */
	public CdReceiptHeaderVO getCdReceiptHeader() {
		return this.cdReceiptHeader;
	}

	
	/**
	 * @param cdReceiptHeader се залага в cdReceiptHeader
	 */
	public void setCdReceiptHeader(CdReceiptHeaderVO cdReceiptHeader) {
		this.cdReceiptHeader = cdReceiptHeader;
	}

	
	/**
	 * @return стойността на cdTypePayment
	 */
	public CdTypePaymentVO getCdTypePayment() {
		return this.cdTypePayment;
	}

	
	/**
	 * @param cdTypePayment се залага в cdTypePayment
	 */
	public void setCdTypePayment(CdTypePaymentVO cdTypePayment) {
		this.cdTypePayment = cdTypePayment;
	}

	
	/**
	 * @return стойността на discount
	 */
	public double getDiscount() {
		return this.discount;
	}

	
	/**
	 * @param discount се залага в discount
	 */
	public void setDiscount(double discount) {
		this.discount = discount;
	}

	
	/**
	 * @return стойността на quantity
	 */
	public double getQuantity() {
		return this.quantity;
	}

	
	/**
	 * @param quantity се залага в quantity
	 */
	public void setQuantity(double quantity) {
		this.quantity = quantity;
	}

	
	/**
	 * @return стойността на receiptBodyId
	 */
	public long getReceiptBodyId() {
		return this.receiptBodyId;
	}

	
	/**
	 * @param receiptBodyId се залага в receiptBodyId
	 */
	public void setReceiptBodyId(long receiptBodyId) {
		this.receiptBodyId = receiptBodyId;
	}

	
	/**
	 * @return стойността на tax
	 */
	public double getTax() {
		return this.tax;
	}

	
	/**
	 * @param tax се залага в tax
	 */
	public void setTax(double tax) {
		this.tax = tax;
	}

	
	/**
	 * @return стойността на text
	 */
	public String getText() {
		return this.text;
	}

	
	/**
	 * @param text се залага в text
	 */
	public void setText(String text) {
		this.text = text;
	}

	/**
	 * @see com.acsior.dac.data.Data#getId()
	 */
	@Override
	public Object getId() {
		return getReceiptBodyId();
	}

	/**
	 * @see com.acsior.dac.impl.hibernate.vo.HibernateVO#setId(java.lang.Object)
	 */
	@Override
	public void setId(Object id) {
		// този не трябва да го викат много-много
		setReceiptBodyId(Long.class.cast(id));
	}

}